package com.atguigu.jucTest.demo;

import java.util.concurrent.TimeUnit;

public class ReadWriteLockDemo {


    public static void main(String[] args) throws InterruptedException {
        MyCache myCache = new MyCache();

        for (int i = 1; i <= 5; i++) {
            final int num = i;
            new Thread(()->{
                myCache.put(num+"",num+"");
            },String.valueOf(i)).start();
        }

        TimeUnit.SECONDS.sleep(3);
        System.out.println(Thread.currentThread().getName());

        for (int i = 1; i <= 5; i++) {
            final int num = i;
            new Thread(()->{
                myCache.get(num+"");
            },String.valueOf(i)).start();
        }

    }
}